var t = getApp();

Page({
    data: {
        last_page: 1,
        current_page: 1,
        grand_amount: 0,
        list_data: [],
        love_name: "",
        active: 1
    },
    onLoad: function(t) {
        this.getData();
    },
    getData: function() {
        var a = this, e = this.data.active, n = {}, s = "";
        4 !== this.data.active ? (s = "plugin.subscription.frontend.modules.activate.controllers.quick.index", 
        n.source_type = e) : s = "plugin.subscription.frontend.modules.activate.controllers.cycle.index", 
        t._postNetWork({
            url: t.getNetAddresss(s),
            data: n,
            success: function(e) {
                if (e.data.result) {
                    var n = e.data.data;
                    a.setData({
                        list_data: n.page_list.data,
                        love_name: n.love_name || "爱心值",
                        grand_amount: n.grand_amount,
                        last_page: n.page_list.last_page
                    });
                } else t.tips(e.data.msg);
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {
        var a = this;
        if (this.data.current_page >= this.data.last_page) return !1;
        var e = this.data.current_page + 1, n = 0 == this.data.active ? "" : this.data.active, s = {
            page: e
        }, i = "";
        4 !== this.data.active ? (i = "plugin.subscription.frontend.modules.activate.controllers.quick.index", 
        s.source_type = n) : i = "plugin.subscription.frontend.modules.activate.controllers.cycle.index", 
        t._postNetWork({
            url: t.getNetAddresss(i),
            data: s,
            success: function(e) {
                e.data.result ? a.setData({
                    list_data: a.data.list_data.concat(e.data.data.page_list.data),
                    last_page: e.data.data.page_list.last_page,
                    current_page: e.data.data.page_list.current_page
                }) : t.tips(e.data.msg);
            }
        });
    },
    onShareAppMessage: function() {},
    change: function(t) {
        var a = t.detail.name;
        this.setData({
            active: a
        }), this.getData();
    }
});